<template>
  <view>
    <!-- 分享组件 -->
    <!-- <shopro-shareInvite v-model="showShare" :shareDetail="shareInfo" posterType="user"></shopro-shareInvite> -->
    <image :src="share"></image>
  </view>
</template>

<script>
  import {
    mapMutations,
    mapActions,
    mapState
  } from 'vuex';

  // #ifdef MP-WEIXIN
  import {
    HAS_LIVE
  } from '@/env';
  import shLive from './components/sh-live.vue';
  // #endif

  import share from '@/shopro/share';
  export default {
    data() {
      return {
        showShare: false,
        shareInfo: null,
        share: '',
        show: true
      }
    },
    computed: {
      ...mapState({
        shop: ({
          shopro
        }) => shopro.config?.shop, // 版本信息
        userTemplate: ({
          shopro
        }) => shopro.template?.user, //模板数据
        userInfo: ({
          user
        }) => user.userInfo,
        isLogin: ({
          user
        }) => user.isLogin,
        authType: ({
          user
        }) => user.authType
      }),
    },
    onLoad() {
      this.$http('user.share').then(res => {
        this.share = res.data;
      })
    },
    onNavigationBarButtonTap() {
      // console.log(1)
      if (this.show) {
        this.show = false;
        uni.share({
          provider: "weixin",
          scene: "WXSceneSession",
          type: 2,
          imageUrl: this.share,
          success: function(res) {
            uni.showToast({
              title: '分享成功',
              icon: 'none'
            })
            this.show = true;
          },
          fail: function(err) {
            uni.showToast({
              title: '分享失败',
              icon: 'none'
            })
            this.show = true;
          }
        });
      }

    },
    onShow() {
      // this.shareInfo = share.setShareInfo({
      //     title: '拼购商城', // 自定义分享标题
      //     desc: '快来玩吧',  // 自定义描述
      //     image: 'http://www.jypintuan.top//uploads/20210727/a30d8023e49e7090c651f9fdbc6867e9.png', // 自定义分享图片
      //    });
      // this.showShare = true;
    },
    methods: {

    }
  }
</script>

<style>
  page {
    background-color: #fe4861;
  }

  image {
    width: 750rpx;
    height: 1334rpx;
  }
</style>
